home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume38 / oraperl-v2 / patch04 next >
Encoding:
Text File  |  1993-06-20  |  62.2 KB  |  2,200 lines

  1. Newsgroups: comp.sources.misc
  2. From: Kevin Stock <kstock@encore.com>
  3. Subject: v38i009: oraperl-v2 - Extensions to Perl to access Oracle database, Patch04
  4. Message-ID: <1993Jun17.192034.16446@sparky.imd.sterling.com>
  5. X-Md4-Signature: 2390c4ed2d49b2ef24612be544747623
  6. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Thu, 17 Jun 1993 19:20:34 GMT
  9. Approved: kent@sparky.imd.sterling.com
  10.  
  11. Submitted-by: Kevin Stock <kstock@encore.com>
  12. Posting-number: Volume 38, Issue 9
  13. Archive-name: oraperl-v2/patch04
  14. Environment: Perl, Oracle with OCI, optionally Curses
  15. Patch-To: oraperl-v2: Volume 30, Issue 87-91
  16.  
  17. This is patch 4 to version 2 of Oraperl, a set of usersubs which allow
  18. Perl to access Oracle databases. You need Perl (v3.0.27 or better) and
  19. Oracle (including the Oracle Call Interface) to build Oraperl. If you
  20. can build Larry's Curseperl, then you can also build Coraperl, which is
  21. Oraperl with Curses.
  22.  
  23. Oraperl version 2 appeared in the comp.sources.misc newsgroup as
  24. follows:
  25.  
  26.     v30i087-091    Part 01-05    29th June 1992
  27.     v30i099        Patch 01    6th July 1992
  28.     v32i093        Patch 02    4th October 1992
  29.     v34i021        Patch 03    12th December 1992
  30.  
  31. Oraperl should be available at any comp.sources.misc archive site,
  32. for example wuarchive.wustl.edu [128.252.135.4] (in the USA) or
  33. src.doc.uc.ac.uk (in the UK). On these two sites, look in the
  34. directory /usenet/comp.sources.misc/volume30/oraperl-v2.
  35.  
  36. I didn't intend to release this patch. Work on DBperl (a standard for
  37. database access from Perl) is well underway, and the next release of
  38. Oraperl should have been version 3, which would have been DBperl
  39. compliant.
  40.  
  41. However, I have been laid off as part of a cost cutting exercise here,
  42. and I don't know when I'll be able to get net access again. So, this
  43. patch tidies up a few outstanding issues.
  44.  
  45. As I no longer have access to the net, please do not try to send me
  46. mail. If you really want, you can write to me at the address below, but
  47. please enclose an International Reply Coupon if you want a reply. I
  48. won't have access to a system running Oracle, so I probably won't be
  49. able to give you much help.
  50.  
  51.   Changes
  52.   -------
  53. &ora_open() and &ora_do() now ignore colons which are not followed by a
  54. digit. This avoids problems with PL/SQL which uses := for an assignment
  55. operator, and :NAME for trigger names.
  56.  
  57. $ora_errstr now looks up the error message using oerhms() if possible,
  58. as the manual says it should.
  59.  
  60. If the first parameter to &ora_login() (the database ID) contains a
  61. colon, then it will be assigned to TWO_TASK, instead of ORACLE_SID.
  62. Note that if you also have a value set in ORACLE_SID, Oracle gets to
  63. use whichever it wants.
  64.  
  65. The sample script sql no longer requires a value for $ORACLE_SID, since
  66. the application may be using TWO_TASK. Also, if the sql statement is not
  67. specified on the command line, it will be read in from standard input.
  68.  
  69.  
  70. To apply the patch, unshar this file in your Oraperl source directory.
  71. Then:
  72.  
  73.     patch -p1 <patch04
  74.     make test
  75.  
  76. My thanks to those who suggested some of these modifications, including
  77. Scott Grosch, Viet Hoang and Charles Jardine.
  78.  
  79.  
  80.     Kevin Stock
  81.  
  82.     5 rue de la Liberation
  83.     78660 ABLIS
  84.     France
  85.  
  86. ==========================
  87. #! /bin/sh
  88. # This is a shell archive.  Remove anything before this line, then feed it
  89. # into a shell via "sh file" or similar.  To overwrite existing files,
  90. # type "sh file -c".
  91. # Contents:  FAQ patch4
  92. # Wrapped by kent@sparky on Thu Jun 17 14:11:42 1993
  93. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  94. echo If this archive is complete, you will see the following message:
  95. echo '          "shar: End of archive 1 (of 1)."'
  96. if test -f 'FAQ' -a "${1}" != "-c" ; then 
  97.   echo shar: Will not clobber existing file \"'FAQ'\"
  98. else
  99.   echo shar: Extracting \"'FAQ'\" \(5279 characters\)
  100.   sed "s/^X//" >'FAQ' <<'END_OF_FILE'
  101. X
  102. X        Frequently Asked Questions for Oraperl
  103. X        ______________________________________
  104. X
  105. X
  106. XWhat is Oraperl?
  107. X----------------
  108. XAccording to Buzz Moschetti, "Oraperl sounds like a denture cleaner".
  109. XFor the rest of us, it's a version of Perl which has been extended to
  110. Xmanipulate Oracle databases.
  111. X
  112. X
  113. XIs Oraperl public domain, shareware, or what?
  114. X---------------------------------------------
  115. XOraperl is Freeware; that is, it's author retains copyright (so it isn't
  116. Xpublic domain) but allows free distribution, under the same terms as
  117. XPerl. It isn't shareware, because you don't have to pay to use it.
  118. X
  119. X
  120. XHow can I contact the author?
  121. X-----------------------------
  122. XUnfortunately, I do not have access to the net at present. If you have
  123. Xproblems with Oraperl, your best bet is to send a message to either
  124. Xcomp.lang.perl or comp.databases.oracle, depending on whether the
  125. Xproblem seems to relate to Perl or to Oracle. A number of Oraperl users
  126. Xhang out on both groups, so you may be able to get an answer there.
  127. X
  128. XIf you really need to contact me, you can write to me at the address
  129. Xbelow. I don't have access to a system running Oracle at present, so I
  130. Xwill only be able to give limited. Please include an International Reply
  131. XCoupon if you want a reply.
  132. X
  133. X    Kevin Stock
  134. X    5 rue de la Liberation
  135. X    78660 ABLIS
  136. X    France
  137. X
  138. X
  139. XWill Oraperl run on my system?
  140. X------------------------------
  141. XAt present, Oraperl is known to run on the following systems:
  142. X
  143. X    Amdhal UTS
  144. X    Convex
  145. X    Encore Multimax, Oracle v6.0.27, Perl 3.0.27 - 4.0.36
  146. X    NeXT
  147. X    Prime EXL MBX Sys V.3.1, Oracle 6.0.26
  148. X    Pyramid (ATT Universe),
  149. X    MIPS (SysVr4)
  150. X    Sparcstation
  151. X    Sperry 500/80 Sys V.3.1, Oracle v5.1, Perl 4.0.3
  152. X    Sun 4/280, Oracle 6.0.30
  153. X    SunOS 4.1.1
  154. X    Ultrix, Oracle v5
  155. X
  156. Xbut if you can build Perl, you can almost certainly build Oraperl.
  157. X
  158. XOraperl is distributed as source, so you build it yourself (or get a
  159. Xfriendly system administrator to do it). You need the following on your
  160. Xsystem to build it:
  161. X
  162. X    C compiler
  163. X    Perl source
  164. X    Oracle Call Interface (part of the Pro*C package)
  165. X
  166. X
  167. XWill Oraperl work with {Dbase, Informix, Ingres, Interbase, Sybase, ...}
  168. X------------------------------------------------------------------------
  169. XNo. Versions of Perl do exist for some of these databases; ask in
  170. Xcomp.databases or comp.lang.perl for help. A project is under way to
  171. Xcreate a unified programming interface for all SQL databases, but
  172. Xthere's a lot of work to do before it is available.
  173. X
  174. X
  175. XWhere can I get Oraperl?
  176. X------------------------
  177. XOraperl version 2 appeared in the comp.sources.misc newsgroup as
  178. Xfollows:
  179. X
  180. X    v30i087-091    Part 01-05    29th June 1992
  181. X    v30i099        Patch 01    6th July 1992
  182. X    v32i093        Patch 02    4th October 1992
  183. X    v34i021        Patch 03    12th December 1992
  184. X
  185. XYou should be able to find it at any comp.sources.misc archive site.
  186. XOne such site in the US is wuarchive.wustl.edu [128.252.135.4]. Look in
  187. Xthe directory /usenet/comp.sources.misc/volume30/oraperl-v2.
  188. X
  189. XYou also need the Perl sources. These are also in the comp.sources.misc
  190. Xarchives. Contact Larry Wall <lwall@netlabs.com> if you need help
  191. Xfinding them.
  192. X
  193. X
  194. XI tried building Oraperl, but cc says "Redeclaration of sprintf in perl.h"
  195. XOraperl compiled OK, but the tests dump core
  196. XOraperl compiled and seems to run OK, but I don't get any output
  197. XOraperl compiled OK, but {something weird} happens
  198. X--------------------------------------------------------------------------
  199. XYou are probably running a dual universe ATT/BSD system and you
  200. Xconfigured Perl under BSD. Oracle programs have to be built under the
  201. XATT universe, so you will have to create an ATT version of uperl.o to
  202. Xlink to Oraperl.  Copy the Perl sources to a different directory and
  203. Xbuild uperl.o there.
  204. X
  205. X
  206. XI tried building Oraperl, but cc says "Undefined: _my_setenv"
  207. X-------------------------------------------------------------
  208. XYou are running an old version of Perl, which doesn't have my_setenv().
  209. XIf possible, you should upgrade to the latest version. If you can't do
  210. Xso, you could try adding one of the following to the start of orafns.c:
  211. X
  212. XIf your system uses  setenv(var, value) :
  213. X
  214. X    #define    my_setenv(var, value)    set_env(var, value)
  215. X
  216. XIf your system uses  putenv(envstring) :
  217. X
  218. X    void my_setenv(var, value)
  219. X    char *var, *value;
  220. X    {
  221. X        static char *envstr = NULL;
  222. X
  223. X        if (envstr == NULL)
  224. X        {
  225. X            if ((envstr = (char *) malloc(1024)) == NULL)
  226. X            {
  227. X                return;
  228. X            }
  229. X            else
  230. X            {
  231. X                sprintf(envstr, "%s=%s", var, value);
  232. X                putenv(envstr);
  233. X            }
  234. X        }
  235. X        else
  236. X        {
  237. X            sprintf(envstr, "%s=%s", var, value);
  238. X        }
  239. X    }
  240. X
  241. X
  242. XWhen I try to build Coraperl, I get messages about undefined functions
  243. X----------------------------------------------------------------------
  244. XYou are probably trying to link Oraperl with the BSD curses routines.
  245. XIf you are on a dual universe system, you should use the ATT routines.
  246. X
  247. XIf you are on a BSD-only system, then you need to modify the file
  248. Xbsdcurses.mus in $(SRC)/usub. You should  #ifdef  out the references to
  249. Xtestcallback .
  250. X
  251. X
  252. XWhenever I try to fetch a DATE or ROWID field, I get a truncation error
  253. X-----------------------------------------------------------------------
  254. XThis is due to a bug in early versions of Oraperl. You should upgrade to
  255. Xthe latest version.
  256. X
  257. XIf you cannot upgrade, you may be able to work round the problem with
  258. XDATE fields by calling the SQL function TO_CHAR() in your SELECT
  259. Xstatement.
  260. END_OF_FILE
  261.   if test 5279 -ne `wc -c <'FAQ'`; then
  262.     echo shar: \"'FAQ'\" unpacked with wrong size!
  263.   fi
  264.   # end of 'FAQ'
  265. fi
  266. if test -f 'patch4' -a "${1}" != "-c" ; then 
  267.   echo shar: Will not clobber existing file \"'patch4'\"
  268. else
  269.   echo shar: Extracting \"'patch4'\" \(51655 characters\)
  270.   sed "s/^X//" >'patch4' <<'END_OF_FILE'
  271. Xdiff -cr oraperl-v2/patchlevel.h oraperl-v2.4/patchlevel.h
  272. X*** oraperl-v2/patchlevel.h    Wed Jun  9 12:33:40 1993
  273. X--- oraperl-v2.4/patchlevel.h    Tue May 25 16:48:33 1993
  274. X***************
  275. X*** 1,4 ****
  276. X  /* patchlevel.h */
  277. X  
  278. X  #define    VERSION        2
  279. X! #define    PATCHLEVEL    3
  280. X--- 1,4 ----
  281. X  /* patchlevel.h */
  282. X  
  283. X  #define    VERSION        2
  284. X! #define    PATCHLEVEL    4
  285. Xdiff -cr oraperl-v2/Changes oraperl-v2.4/Changes
  286. X*** oraperl-v2/Changes    Wed Jun  9 12:33:40 1993
  287. X--- oraperl-v2.4/Changes    Wed Jun  9 12:09:14 1993
  288. X***************
  289. X*** 4,9 ****
  290. X--- 4,17 ----
  291. X  Version 2
  292. X  =========
  293. X  
  294. X+ Patch 04
  295. X+ ========
  296. X+ Now uses oerhms() to get the error text if possible
  297. X+ count_colons() ignores colons which are not followed by a digit (for PL/SQL)
  298. X+ Fixed a few typos in the documentation
  299. X+ &ora_login() uses TWO_TASK instead of ORACLE_SID if the sid contains a colon
  300. X+ sql now reads a script from stdin if it isn't on the command line
  301. X+ 
  302. X  Patch 03
  303. X  ========
  304. X  Modify &ora_bind() and &ora_do() to return the row count
  305. Xdiff -cr oraperl-v2/Debugging oraperl-v2.4/Debugging
  306. X*** oraperl-v2/Debugging    Wed Jun  9 12:31:54 1993
  307. X--- oraperl-v2.4/Debugging    Wed Jun  9 14:23:41 1993
  308. X***************
  309. X*** 47,53 ****
  310. X  output lines.
  311. X  
  312. X  If your uperl.o was built with -DDEBUGGING, you can define PERL_DEBUGGING
  313. X! at compilation and the oraperl debugging will be initialiased from the -D
  314. X  flag. If not, you can still define DEBUGGING, but you will have to set
  315. X  ora_debug from within your program.
  316. X  
  317. X--- 47,53 ----
  318. X  output lines.
  319. X  
  320. X  If your uperl.o was built with -DDEBUGGING, you can define PERL_DEBUGGING
  321. X! at compilation and the oraperl debugging will be initialised from the -D
  322. X  flag. If not, you can still define DEBUGGING, but you will have to set
  323. X  ora_debug from within your program.
  324. X  
  325. X***************
  326. X*** 56,62 ****
  327. X  DBUG package recommends -# (and so the routines will remove a leading -#
  328. X  from the control string if there is one). For example, I use this line:
  329. X  
  330. X!     $ora_debug = shift if $ARGV[0] =~ /-#/;
  331. X  
  332. X  If you want to trace something else, you can add your own DBUG_PRINT
  333. X  statements to the code wherever you want. I would recommend that you use
  334. X--- 56,62 ----
  335. X  DBUG package recommends -# (and so the routines will remove a leading -#
  336. X  from the control string if there is one). For example, I use this line:
  337. X  
  338. X!     $ora_debug = shift if $ARGV[0] =~ /^-#/;
  339. X  
  340. X  If you want to trace something else, you can add your own DBUG_PRINT
  341. X  statements to the code wherever you want. I would recommend that you use
  342. Xdiff -cr oraperl-v2/Readme oraperl-v2.4/Readme
  343. X*** oraperl-v2/Readme    Wed Jun  9 12:33:41 1993
  344. X--- oraperl-v2.4/Readme    Wed Jun  9 14:33:21 1993
  345. X***************
  346. X*** 49,55 ****
  347. X  
  348. X  I've only tested this on an Encore Multimax 520 running UMAX V (Sys Vr3.2),
  349. X  using whichever version of Perl was current at the time that I completed
  350. X! each release (covers the range 3.0.34 to 4.0.35, excluding 4.0.33) with
  351. X  Oracle version 6, as I don't have access to any other system with Pro*C.
  352. X  However, other people have compiled and used it on a range of different
  353. X  systems including Amdahl, Convex, Cray, NeXT, Pyramid, Sun and Ultrix,
  354. X--- 49,55 ----
  355. X  
  356. X  I've only tested this on an Encore Multimax 520 running UMAX V (Sys Vr3.2),
  357. X  using whichever version of Perl was current at the time that I completed
  358. X! each release (covers the range 3.0.34 to 4.0.36, excluding 4.0.33) with
  359. X  Oracle version 6, as I don't have access to any other system with Pro*C.
  360. X  However, other people have compiled and used it on a range of different
  361. X  systems including Amdahl, Convex, Cray, NeXT, Pyramid, Sun and Ultrix,
  362. X***************
  363. X*** 85,90 ****
  364. X--- 85,91 ----
  365. X      ckdebug.pl    tests to see if debugging is available
  366. X      commit.pl    using commit and rollback
  367. X      ex.pl        simple example of Oraperl functions
  368. X+     japh        just another perl hacker, in Oraperl
  369. X      mkdb.pl        more extensive example, using curses if available
  370. X              you can run this with either Oraperl or Coraperl
  371. X      oradump.pl    dump an Oracle table into a set of insert statements
  372. X***************
  373. X*** 100,105 ****
  374. X--- 101,107 ----
  375. X      Readme         test information
  376. X      Standard-Results correct results for a test run
  377. X      commit.pl     test script
  378. X+     japh.pl         test script
  379. X      mkdb.pl         test script
  380. X  
  381. X  Miscellaneous:
  382. X***************
  383. X*** 124,129 ****
  384. X  Corporation or any of their subsidiaries. There is no warranty, and no
  385. X  official support is available.
  386. X  
  387. X! It is Copyright 1991, 1992 Kevin Stock, but may be freely distributed
  388. X  under the same terms as Perl itself, that is, under the terms of either
  389. X  the GNU Public License or the Artistic License.
  390. X--- 126,131 ----
  391. X  Corporation or any of their subsidiaries. There is no warranty, and no
  392. X  official support is available.
  393. X  
  394. X! It is Copyright 1991, 1992, 1993 Kevin Stock, but may be freely distributed
  395. X  under the same terms as Perl itself, that is, under the terms of either
  396. X  the GNU Public License or the Artistic License.
  397. Xdiff -cr oraperl-v2/colons.c oraperl-v2.4/colons.c
  398. X*** oraperl-v2/colons.c    Wed Jun  9 12:32:08 1993
  399. X--- oraperl-v2.4/colons.c    Wed Jun  9 12:39:28 1993
  400. X***************
  401. X*** 2,8 ****
  402. X   *
  403. X   * Returns the number of substitution variables in an SQL query.
  404. X   */
  405. X! /* Copyright 1991, 1992 Kevin Stock.
  406. X   *
  407. X   * You may copy this under the terms of the GNU General Public License,
  408. X   * or the Artistic License, copies of which should have accompanied your
  409. X--- 2,8 ----
  410. X   *
  411. X   * Returns the number of substitution variables in an SQL query.
  412. X   */
  413. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  414. X   *
  415. X   * You may copy this under the terms of the GNU General Public License,
  416. X   * or the Artistic License, copies of which should have accompanied your
  417. X***************
  418. X*** 10,15 ****
  419. X--- 10,16 ----
  420. X   */
  421. X  
  422. X  #include <stdio.h>
  423. X+ #include <ctype.h>
  424. X  #include "EXTERN.h"
  425. X  #include "orafns.h"
  426. X  
  427. X***************
  428. X*** 29,46 ****
  429. X              /* numbers must be used in sequence,
  430. X               * but they may be repeated if a parameter is reused
  431. X               */
  432. X!             if (((c = atoi(++s)) <= 0) || (c > n+1))
  433. X              {
  434. X!                 /* number too low or out of sequence */
  435. X!                 DBUG_PRINT("exit",
  436. X!                 ("count_colons: got %d, expected %d", c, n+1));
  437. X!                 DBUG_RETURN(-1);
  438. X              }
  439. X!             else if (c == n + 1)
  440. X              {
  441. X!                 ++n;
  442. X              }
  443. X-             /* else repeating a previous parameter */
  444. X          }
  445. X          else if (*s == '\'')
  446. X          {
  447. X--- 30,56 ----
  448. X              /* numbers must be used in sequence,
  449. X               * but they may be repeated if a parameter is reused
  450. X               */
  451. X! 
  452. X!             if (isdigit(*++s))
  453. X              {
  454. X!                 if (((c = atoi(s)) <= 0) || (c > n+1))
  455. X!                 {
  456. X!                     /* number too low or out of sequence */
  457. X!                     DBUG_PRINT("exit",
  458. X!                         ("count_colons: got %d, expected %d",
  459. X!                     c, n+1));
  460. X!                     DBUG_RETURN(-1);
  461. X!                 }
  462. X!                 else if (c == n + 1)
  463. X!                 {
  464. X!                     ++n;
  465. X!                 }
  466. X!                 /* else repeating a previous parameter */
  467. X              }
  468. X!             else
  469. X              {
  470. X!                 DBUG_PRINT("info", ("ignoring :%c", *s));
  471. X              }
  472. X          }
  473. X          else if (*s == '\'')
  474. X          {
  475. Xdiff -cr oraperl-v2/doc/oraperl.1 oraperl-v2.4/doc/oraperl.1
  476. X*** oraperl-v2/doc/oraperl.1    Wed Jun  9 12:33:42 1993
  477. X--- oraperl-v2.4/doc/oraperl.1    Wed Jun  9 11:23:56 1993
  478. X***************
  479. X*** 79,85 ****
  480. X  correlating or transferring data between databases.
  481. X  
  482. X  Most \fIOracle\fP programs (for example, \fISQL*Plus\fP or \fISQL*Forms\fP)
  483. X! examine the environment variable \fBORACLE_SID\fP
  484. X  to determine which database to connect to.
  485. X  In an environment which uses several different databases,
  486. X  it is easy to make a mistake, and attempt to run a program on the wrong one.
  487. X--- 79,85 ----
  488. X  correlating or transferring data between databases.
  489. X  
  490. X  Most \fIOracle\fP programs (for example, \fISQL*Plus\fP or \fISQL*Forms\fP)
  491. X! examine the environment variable \fBORACLE_SID\fP or \fBTWO_TASK\fP
  492. X  to determine which database to connect to.
  493. X  In an environment which uses several different databases,
  494. X  it is easy to make a mistake, and attempt to run a program on the wrong one.
  495. X***************
  496. X*** 86,94 ****
  497. X  Also, it is cumbersome to create a program
  498. X  which works with more than one database simultaneously.
  499. X  Therefore, \fIOraperl\fP requires the system ID to be passed as a parameter.
  500. X- However, if the system ID parameter is an empty string
  501. X- then \fIOraperl\fP will use the existing value of \fBORACLE_SID\fP.
  502. X  
  503. X  .ne 4
  504. X  Example:
  505. X  
  506. X--- 86,100 ----
  507. X  Also, it is cumbersome to create a program
  508. X  which works with more than one database simultaneously.
  509. X  Therefore, \fIOraperl\fP requires the system ID to be passed as a parameter.
  510. X  
  511. X+ If the system ID parameter contains a colon,
  512. X+ it is assumed to be a \fBTWO_TASK\fP value.
  513. X+ Otherwise, if it is not blank,
  514. X+ it is assumed to be an \fBORACLE_SID\fP value.
  515. X+ If it is blank,
  516. X+ the current values of \fBORACLE_SID\fP and \fBTWO_TASK\fP
  517. X+ will be left unchanged.
  518. X+ 
  519. X  .ne 4
  520. X  Example:
  521. X  
  522. X***************
  523. X*** 167,173 ****
  524. X  .ti +.5i
  525. X  .if t .ft CW
  526. X  &ora_bind($csr, 70, 'marketing', undef);
  527. X! .if t .fi P
  528. X  
  529. X  \fI&ora_bind()\fP returns an undefined value if an error occurred.
  530. X  Otherwise, it returns the number of rows affected by the command
  531. X--- 173,179 ----
  532. X  .ti +.5i
  533. X  .if t .ft CW
  534. X  &ora_bind($csr, 70, 'marketing', undef);
  535. X! .if t .ft P
  536. X  
  537. X  \fI&ora_bind()\fP returns an undefined value if an error occurred.
  538. X  Otherwise, it returns the number of rows affected by the command
  539. X***************
  540. X*** 343,349 ****
  541. X  by calling the \fI&ora_types()\fP function.
  542. X  This function takes a single parameter,
  543. X  a statement identifier (obtained from \fI&ora_open()\fP)
  544. X! indicating the query for which the lengths are required.
  545. X  The types are returned as an array of integers, one for each field.
  546. X  
  547. X  These types are defined in your OCI documentation.
  548. X--- 349,355 ----
  549. X  by calling the \fI&ora_types()\fP function.
  550. X  This function takes a single parameter,
  551. X  a statement identifier (obtained from \fI&ora_open()\fP)
  552. X! indicating the query for which the types are required.
  553. X  The types are returned as an array of integers, one for each field.
  554. X  
  555. X  These types are defined in your OCI documentation.
  556. X***************
  557. X*** 513,519 ****
  558. X  The \fI$ora_errstr\fP variable contains the \fIOracle\fP error message
  559. X  corresponding to the current value of \fI$ora_errno\fP.
  560. X  
  561. X! This is equivalent to the \fIOCI oerrmsg\fP function.
  562. X  .\"
  563. X  .SH "$ora_verno"
  564. X  .\"
  565. X--- 519,525 ----
  566. X  The \fI$ora_errstr\fP variable contains the \fIOracle\fP error message
  567. X  corresponding to the current value of \fI$ora_errno\fP.
  568. X  
  569. X! This is equivalent to the \fIOCI oerhms\fI and \fIoermsg\fP functions.
  570. X  .\"
  571. X  .SH "$ora_verno"
  572. X  .\"
  573. X***************
  574. X*** 568,576 ****
  575. X  Note that the substitution variables must be assigned consecutively
  576. X  beginning from \fB1\fP for each SQL statement,
  577. X  as \fI&ora_bind()\fP assigns its parameters in this order.
  578. X! Named substitution variables
  579. X! (for example, \fB:NAME\fP, \fB:TELNO\fP)
  580. X! are not permitted.
  581. X  .\"
  582. X  .SH DEBUGGING
  583. X  .\"
  584. X--- 574,585 ----
  585. X  Note that the substitution variables must be assigned consecutively
  586. X  beginning from \fB1\fP for each SQL statement,
  587. X  as \fI&ora_bind()\fP assigns its parameters in this order.
  588. X! 
  589. X! \fIOraperl\fP does not recognise the named substitution variables
  590. X! (for example, :NAME, :TELNO) which are allowed by the \fIOCI\fP.
  591. X! Any colon which is not followed by a digit will be ignored by \fIOraperl\fP
  592. X! and passed on to the \fIOracle\fP engine.
  593. X! This allows PL/SQL assignments and triggers to be used.
  594. X  .\"
  595. X  .SH DEBUGGING
  596. X  .\"
  597. Xdiff -cr oraperl-v2/examples/sql oraperl-v2.4/examples/sql
  598. X*** oraperl-v2/examples/sql    Wed Jun  9 12:33:43 1993
  599. X--- oraperl-v2.4/examples/sql    Wed Jun  9 14:42:17 1993
  600. X***************
  601. X*** 18,56 ****
  602. X  #    -l page_len      lines per page, only used by -f (default 60)
  603. X  #    -n string      replace NULL fields by string
  604. X  #    name/pass    * Oracle username and password
  605. X! #    stmt        * Oracle statement to be executed
  606. X  #
  607. X  # Author:    Kevin Stock
  608. X  # Date:        18th November 1991
  609. X! # Last change:    18th November 1992
  610. X  #
  611. X  
  612. X  $ora_debug = shift if $ARGV[0] =~ /^-#/;
  613. X  
  614. X  $USAGE = <<;
  615. X!     [-bbase] [-ccache] [-ddelim] [-f|-h] [-lpage_len] [-nstring] name/pass stmt
  616. X  
  617. X- $, = "\t";            # default delimiter is a tab
  618. X- $\ = "\n";            # each record terminated with newline
  619. X- 
  620. X  require 'getopts.pl';        # option parsing
  621. X  do Getopts('b:c:d:fhl:n:');
  622. X  die "$0: only one of -f and -h may be specified\n" if ($opt_f && $opt_h);
  623. X  
  624. X! $USER = shift;            # get the user name and password
  625. X! die "Usage: $0 $USAGE\n" unless $#ARGV >= 0;        # must have a statement
  626. X  
  627. X! $ENV{'ORACLE_SID'} = $opt_b if defined($opt_b);        # set database
  628. X  $ora_cache = $opt_c if defined($opt_c);            # set fetch cache
  629. X  $, = $opt_d if defined($opt_d);                # set column delimiter
  630. X  $= = $opt_l if defined($opt_l);                # set page length
  631. X  
  632. X- die "ORACLE_SID not set\n" unless defined($ENV{'ORACLE_SID'});
  633. X- 
  634. X  # log into the database and execute the statement
  635. X  
  636. X! $lda = &ora_login('', $USER, '') || die "$ora_errstr\n";
  637. X! $csr = &ora_open($lda, "@ARGV") || die "$ora_errstr\n";
  638. X  
  639. X  # print out any information which comes back
  640. X  
  641. X--- 18,64 ----
  642. X  #    -l page_len      lines per page, only used by -f (default 60)
  643. X  #    -n string      replace NULL fields by string
  644. X  #    name/pass    * Oracle username and password
  645. X! #    stmt          Oracle statement to be executed
  646. X! #              read from stdin if not given on command line
  647. X  #
  648. X  # Author:    Kevin Stock
  649. X  # Date:        18th November 1991
  650. X! # Last change:    9th June 1993
  651. X  #
  652. X  
  653. X  $ora_debug = shift if $ARGV[0] =~ /^-#/;
  654. X  
  655. X  $USAGE = <<;
  656. X! [-bbase] [-ccache] [-ddelim] [-f|-h] [-lpage_len] [-nstring] name/pass [stmt]
  657. X  
  658. X  require 'getopts.pl';        # option parsing
  659. X  do Getopts('b:c:d:fhl:n:');
  660. X  die "$0: only one of -f and -h may be specified\n" if ($opt_f && $opt_h);
  661. X  
  662. X! $USER = shift || die "user/password not specified\n";
  663. X! 
  664. X! if ($#ARGV >= 0)
  665. X! {
  666. X!     @stmt = @ARGV;
  667. X! }
  668. X! else
  669. X! {
  670. X!     print "Enter the statement to execute (^D to end):\n";
  671. X!     @stmt = <STDIN>;
  672. X! }
  673. X! 
  674. X! $, = "\t";            # default delimiter is a tab
  675. X! $\ = "\n";            # each record terminated with newline
  676. X  
  677. X! $db = $opt_b if defined($opt_b);            # set database
  678. X  $ora_cache = $opt_c if defined($opt_c);            # set fetch cache
  679. X  $, = $opt_d if defined($opt_d);                # set column delimiter
  680. X  $= = $opt_l if defined($opt_l);                # set page length
  681. X  
  682. X  # log into the database and execute the statement
  683. X  
  684. X! $lda = &ora_login($db, $USER, '') || die "$ora_errstr\n";
  685. X! $csr = &ora_open($lda, "@stmt") || die "$ora_errstr\n";
  686. X  
  687. X  # print out any information which comes back
  688. X  
  689. X***************
  690. X*** 129,135 ****
  691. X  .nr nl 0-1        \" fake up transition to first page again
  692. X  .nr % 0            \" start at page 1
  693. X  ';<<'.ex'; ############## From here on it's a standard manual page ############
  694. X- .ll 80
  695. X  .TH SQL L "18th November 1992"
  696. X  .ad
  697. X  .nh
  698. X--- 137,142 ----
  699. X***************
  700. X*** 155,161 ****
  701. X  
  702. X  The \fB\-b\fP\fIbase\fP flag may be supplied to specify the database to be used.
  703. X  If it is not given, the database specified by the environment variable
  704. X! \fBORACLE_SID\fP is used.
  705. X  
  706. X  The \fB\-c\fP\fIcache\fP flag may be supplied to set the size of fetch cache
  707. X  to be used. If it is not given, the system default is used.
  708. X--- 162,168 ----
  709. X  
  710. X  The \fB\-b\fP\fIbase\fP flag may be supplied to specify the database to be used.
  711. X  If it is not given, the database specified by the environment variable
  712. X! \fBORACLE_SID\fP or \fBTWO_TASK\fP is used.
  713. X  
  714. X  The \fB\-c\fP\fIcache\fP flag may be supplied to set the size of fetch cache
  715. X  to be used. If it is not given, the system default is used.
  716. X***************
  717. X*** 182,188 ****
  718. X  this may be changed to any desired string (\fIdelim\fP)
  719. X  using the \fB\-d\fP flag.
  720. X  .SH ENVIRONMENT
  721. X! The environment variable \fBORACLE_SID\fP
  722. X  determines the Oracle database to be used
  723. X  if the \fB\-b\fP\fIbase\fP flag is not supplied.
  724. X  .SH DIAGNOSTICS
  725. X--- 189,195 ----
  726. X  this may be changed to any desired string (\fIdelim\fP)
  727. X  using the \fB\-d\fP flag.
  728. X  .SH ENVIRONMENT
  729. X! The environment variable \fBORACLE_SID\fP or \fBTWO_TASK\fP
  730. X  determines the Oracle database to be used
  731. X  if the \fB\-b\fP\fIbase\fP flag is not supplied.
  732. X  .SH DIAGNOSTICS
  733. X***************
  734. X*** 192,204 ****
  735. X  .br
  736. X  the \fB\-f\fP and \fB\-h\fP options are mutually exclusive,
  737. X  but both were specified
  738. X- 
  739. X- .ti -5
  740. X- \fBORACLE_SID not set\fP
  741. X- .br
  742. X- the \fB\-b\fP\fIbase\fP option was not supplied,
  743. X- and the \fBORACLE_SID\fP environment variable was not set,
  744. X- so \fIsql\fP cannot work out which database to open
  745. X  
  746. X  .in -5
  747. X  The only other diagnostics generated by \fIsql\fP are usage messages,
  748. X--- 199,204 ----
  749. Xdiff -cr oraperl-v2/getcursor.c oraperl-v2.4/getcursor.c
  750. X*** oraperl-v2/getcursor.c    Wed Jun  9 12:31:51 1993
  751. X--- oraperl-v2.4/getcursor.c    Wed Jun  9 10:51:55 1993
  752. X***************
  753. X*** 2,8 ****
  754. X   *
  755. X   * Functions to deal with allocating and freeing cursors for Oracle
  756. X   */
  757. X! /* Copyright 1991, 1992 Kevin Stock.
  758. X   *
  759. X   * You may copy this under the terms of the GNU General Public License,
  760. X   * or the Artistic License, copies of which should have accompanied your
  761. X--- 2,8 ----
  762. X   *
  763. X   * Functions to deal with allocating and freeing cursors for Oracle
  764. X   */
  765. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  766. X   *
  767. X   * You may copy this under the terms of the GNU General Public License,
  768. X   * or the Artistic License, copies of which should have accompanied your
  769. X***************
  770. X*** 17,23 ****
  771. X  
  772. X  /* head of the cursor list */
  773. X  struct cursor csr_list =
  774. X!     { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL };
  775. X  
  776. X  
  777. X  /* ora_free_data(csr)
  778. X--- 17,23 ----
  779. X  
  780. X  /* head of the cursor list */
  781. X  struct cursor csr_list =
  782. X!     { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL };
  783. X  
  784. X  
  785. X  /* ora_free_data(csr)
  786. X***************
  787. X*** 108,114 ****
  788. X      {
  789. X          DBUG_PRINT("malloc", ("insufficient memory for a cursor"));
  790. X          DBUG_PRINT("exit", ("returning NULL"));
  791. X!         ora_errno = ORAP_NOMEM;
  792. X          DBUG_RETURN(NULL);
  793. X      }
  794. X      DBUG_PRINT("malloc", ("got a cursor at %#lx", (long) tmp));
  795. X--- 108,115 ----
  796. X      {
  797. X          DBUG_PRINT("malloc", ("insufficient memory for a cursor"));
  798. X          DBUG_PRINT("exit", ("returning NULL"));
  799. X!         ora_err.no = ORAP_NOMEM;
  800. X!         ora_err.lda = NULL;
  801. X          DBUG_RETURN(NULL);
  802. X      }
  803. X      DBUG_PRINT("malloc", ("got a cursor at %#lx", (long) tmp));
  804. X***************
  805. X*** 118,124 ****
  806. X          free(tmp);
  807. X          DBUG_PRINT("malloc", ("insufficient memory for a csrdef"));
  808. X          DBUG_PRINT("exit", ("returning NULL"));
  809. X!         ora_errno = ORAP_NOMEM;
  810. X          DBUG_RETURN(NULL);
  811. X      }
  812. X      DBUG_PRINT("malloc", ("got a csr at %#lx", (long) tmp->csr));
  813. X--- 119,126 ----
  814. X          free(tmp);
  815. X          DBUG_PRINT("malloc", ("insufficient memory for a csrdef"));
  816. X          DBUG_PRINT("exit", ("returning NULL"));
  817. X!         ora_err.no = ORAP_NOMEM;
  818. X!         ora_err.lda = NULL;
  819. X          DBUG_RETURN(NULL);
  820. X      }
  821. X      DBUG_PRINT("malloc", ("got a csr at %#lx", (long) tmp->csr));
  822. X***************
  823. X*** 134,144 ****
  824. X      tmp->next_entry = 0;
  825. X      tmp->nfields = 0;
  826. X      tmp->varfields = 0;
  827. X  
  828. X      tmp->next = csr_list.next;
  829. X      csr_list.next = tmp;
  830. X  
  831. X!     ora_errno = 0;
  832. X      DBUG_PRINT("exit", ("returning %#lx", (long) tmp));
  833. X      DBUG_RETURN(tmp);
  834. X  }
  835. X--- 136,148 ----
  836. X      tmp->next_entry = 0;
  837. X      tmp->nfields = 0;
  838. X      tmp->varfields = 0;
  839. X+     tmp->parent = NULL;
  840. X  
  841. X      tmp->next = csr_list.next;
  842. X      csr_list.next = tmp;
  843. X  
  844. X!     ora_err.no = 0;
  845. X!     ora_err.lda = NULL;
  846. X      DBUG_PRINT("exit", ("returning %#lx", (long) tmp));
  847. X      DBUG_RETURN(tmp);
  848. X  }
  849. X***************
  850. X*** 167,173 ****
  851. X      {
  852. X          DBUG_PRINT("malloc", ("insufficient memory for an hda"));
  853. X          ora_dropcursor(tmp);
  854. X!         ora_errno = ORAP_NOMEM;
  855. X          DBUG_PRINT("exit", ("returning NULL"));
  856. X          DBUG_RETURN(NULL);
  857. X      }
  858. X--- 171,178 ----
  859. X      {
  860. X          DBUG_PRINT("malloc", ("insufficient memory for an hda"));
  861. X          ora_dropcursor(tmp);
  862. X!         ora_err.no = ORAP_NOMEM;
  863. X!         ora_err.lda = NULL;
  864. X          DBUG_PRINT("exit", ("returning NULL"));
  865. X          DBUG_RETURN(NULL);
  866. X      }
  867. X***************
  868. X*** 199,205 ****
  869. X  
  870. X      if (tmp->next == NULL)
  871. X      {
  872. X!         ora_errno = ORAP_INVCSR;
  873. X          DBUG_PRINT("exit", ("not a cursor"));
  874. X          DBUG_RETURN(0);
  875. X      }
  876. X--- 204,211 ----
  877. X  
  878. X      if (tmp->next == NULL)
  879. X      {
  880. X!         ora_err.no = ORAP_INVCSR;
  881. X!         ora_err.lda = NULL;
  882. X          DBUG_PRINT("exit", ("not a cursor"));
  883. X          DBUG_RETURN(0);
  884. X      }
  885. Xdiff -cr oraperl-v2/oracle.mus oraperl-v2.4/oracle.mus
  886. X*** oraperl-v2/oracle.mus    Wed Jun  9 12:33:44 1993
  887. X--- oraperl-v2.4/oracle.mus    Wed Jun  9 11:28:42 1993
  888. X***************
  889. X*** 5,11 ****
  890. X   * NOTE: Do not modify oracle.c as it is created automagically from oracle.mus.
  891. X   *     Modify oracle.mus instead, or your changes will be lost.
  892. X   */
  893. X! /* Copyright 1991, 1992 Kevin Stock.
  894. X   *
  895. X   * You may copy this under the terms of the GNU General Public License,
  896. X   * or the Artistic License, copies of which should have accompanied your
  897. X--- 5,11 ----
  898. X   * NOTE: Do not modify oracle.c as it is created automagically from oracle.mus.
  899. X   *     Modify oracle.mus instead, or your changes will be lost.
  900. X   */
  901. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  902. X   *
  903. X   * You may copy this under the terms of the GNU General Public License,
  904. X   * or the Artistic License, copies of which should have accompanied your
  905. X***************
  906. X*** 231,237 ****
  907. X  
  908. X          if (vars == NULL)
  909. X          {
  910. X!         ora_errno = ORAP_NOMEM;
  911. X          retval = 0;
  912. X          }
  913. X          else
  914. X--- 231,237 ----
  915. X  
  916. X          if (vars == NULL)
  917. X          {
  918. X!         ora_err.no = ORAP_NOMEM;
  919. X          retval = 0;
  920. X          }
  921. X          else
  922. X***************
  923. X*** 493,499 ****
  924. X      break;
  925. X  
  926. X      case UV_ora_errno:
  927. X!     str_numset(str, (double) ora_errno);
  928. X      break;
  929. X  
  930. X      case UV_ora_verno:
  931. X--- 493,499 ----
  932. X      break;
  933. X  
  934. X      case UV_ora_errno:
  935. X!     str_numset(str, (double) ora_err.no);
  936. X      break;
  937. X  
  938. X      case UV_ora_verno:
  939. X***************
  940. X*** 500,513 ****
  941. X      str_numset(str, (double) (VERSION + (double) PATCHLEVEL / 1000));
  942. X      break;
  943. X  
  944. X!     case UV_ora_errstr:
  945. X      {
  946. X          int len;
  947. X!         char ertxt[132];
  948. X  
  949. X!         if (ora_errno < ORAP_ERRMIN)
  950. X          {
  951. X!             oermsg(ora_errno, ertxt);
  952. X              if (ertxt[len = (strlen(ertxt) - 1)] == '\n')
  953. X              {
  954. X                  ertxt[len] = '\0';
  955. X--- 500,528 ----
  956. X      str_numset(str, (double) (VERSION + (double) PATCHLEVEL / 1000));
  957. X      break;
  958. X  
  959. X!    case UV_ora_errstr:
  960. X      {
  961. X          int len;
  962. X!         char ertxt[256];
  963. X  
  964. X!         if (ora_err.no < ORAP_ERRMIN)
  965. X          {
  966. X!             DBUG_PRINT("info",
  967. X!                 ("ora_err.no = %d, ora_err.lda = 0x%x",
  968. X!                  ora_err.no, ora_err.lda));
  969. X! 
  970. X!             if (ora_err.lda == NULL)
  971. X!             {
  972. X!                 /* lda isn't set */
  973. X!                 DBUG_PRINT("info", ("Using oermsg"));
  974. X!                 oermsg(ora_err.no, ertxt);
  975. X!             }
  976. X!             else
  977. X!             {
  978. X!                 DBUG_PRINT("info", ("Using oerhms"));
  979. X!                 oerhms(ora_err.lda->csr, ora_err.no, ertxt,256);
  980. X!             }
  981. X! 
  982. X              if (ertxt[len = (strlen(ertxt) - 1)] == '\n')
  983. X              {
  984. X                  ertxt[len] = '\0';
  985. X***************
  986. X*** 514,527 ****
  987. X              }
  988. X              str_set(str, ertxt);
  989. X          }
  990. X!         else if((ora_errno == ORAP_ERRMIN) || (ora_errno > ORAP_ERRMAX))
  991. X          {
  992. X!             sprintf(ertxt, "unknown error %d", ora_errno);
  993. X              str_set(str, ertxt);
  994. X          }
  995. X          else
  996. X          {
  997. X!             str_set(str, ora_errlist[ora_errno - ORAP_ERRMIN]);
  998. X          }
  999. X      }
  1000. X      break;
  1001. X--- 529,543 ----
  1002. X              }
  1003. X              str_set(str, ertxt);
  1004. X          }
  1005. X!         else if ((ora_err.no == ORAP_ERRMIN) ||
  1006. X!              (ora_err.no > ORAP_ERRMAX))
  1007. X          {
  1008. X!             sprintf(ertxt, "unknown error %d", ora_err.no);
  1009. X              str_set(str, ertxt);
  1010. X          }
  1011. X          else
  1012. X          {
  1013. X!             str_set(str, ora_errlist[ora_err.no - ORAP_ERRMIN]);
  1014. X          }
  1015. X      }
  1016. X      break;
  1017. Xdiff -cr oraperl-v2/orafns.c oraperl-v2.4/orafns.c
  1018. X*** oraperl-v2/orafns.c    Wed Jun  9 12:33:44 1993
  1019. X--- oraperl-v2.4/orafns.c    Wed Jun  9 11:58:54 1993
  1020. X***************
  1021. X*** 2,8 ****
  1022. X   *
  1023. X   * Simple C interface to Oracle, intended to be linked to Perl.
  1024. X   */
  1025. X! /* Copyright 1991, 1992 Kevin Stock.
  1026. X   *
  1027. X   * You may copy this under the terms of the GNU General Public License,
  1028. X   * or the Artistic License, copies of which should have accompanied your
  1029. X--- 2,8 ----
  1030. X   *
  1031. X   * Simple C interface to Oracle, intended to be linked to Perl.
  1032. X   */
  1033. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  1034. X   *
  1035. X   * You may copy this under the terms of the GNU General Public License,
  1036. X   * or the Artistic License, copies of which should have accompanied your
  1037. X***************
  1038. X*** 60,91 ****
  1039. X  /* oracle_sid is just used so that we don't keep repeating the string */
  1040. X  
  1041. X  static char *oracle_sid        = "ORACLE_SID";
  1042. X  
  1043. X  
  1044. X  /* set_sid() uses my_setenv() to set ORACLE_SID to the required database.
  1045. X   * It preserves the old value of ORACLE_SID so that it can be restored
  1046. X   * (by calling set_sid() with NULL as its parameter.
  1047. X   */
  1048. X  
  1049. X! void set_sid(db)
  1050. X  char *db;
  1051. X  {
  1052. X!     char *h;
  1053. X      static char *oldsid        = NULL;
  1054. X  
  1055. X      DBUG_ENTER("set_sid");
  1056. X      DBUG_PRINT("entry", ("set_sid(%s)", db ? db : "<NULL>"));
  1057. X  
  1058. X!     ora_errno = 0;
  1059. X  
  1060. X      if (db == NULL)
  1061. X      {
  1062. X          if (oldsid != NULL)
  1063. X          {
  1064. X!             DBUG_PRINT("info", ("setting oracle_sid to %s",oldsid));
  1065. X!             my_setenv(oracle_sid, oldsid);
  1066. X          }
  1067. X-         /* no old value to restore if oldsid == NULL */
  1068. X      }
  1069. X      else
  1070. X      {
  1071. X--- 60,104 ----
  1072. X  /* oracle_sid is just used so that we don't keep repeating the string */
  1073. X  
  1074. X  static char *oracle_sid        = "ORACLE_SID";
  1075. X+ static char *two_task        = "TWO_TASK";
  1076. X  
  1077. X  
  1078. X  /* set_sid() uses my_setenv() to set ORACLE_SID to the required database.
  1079. X   * It preserves the old value of ORACLE_SID so that it can be restored
  1080. X   * (by calling set_sid() with NULL as its parameter.
  1081. X+  *
  1082. X+  * If db contains a colon, then TWO_TASK is used instead of ORACLE_SID.
  1083. X   */
  1084. X  
  1085. X! set_sid(db)
  1086. X  char *db;
  1087. X  {
  1088. X!     char *h, *var;
  1089. X      static char *oldsid        = NULL;
  1090. X  
  1091. X      DBUG_ENTER("set_sid");
  1092. X      DBUG_PRINT("entry", ("set_sid(%s)", db ? db : "<NULL>"));
  1093. X  
  1094. X!     ora_err.no = 0;
  1095. X!     ora_err.lda = NULL;
  1096. X  
  1097. X      if (db == NULL)
  1098. X      {
  1099. X          if (oldsid != NULL)
  1100. X          {
  1101. X!             var = (strchr(oldsid, ':') == NULL) ? oracle_sid
  1102. X!                                  : two_task;
  1103. X! 
  1104. X!             DBUG_PRINT("info", ("resetting %s to %s", var, oldsid));
  1105. X!             my_setenv(var, oldsid);
  1106. X!             DBUG_RETURN(1);        /* assume it worked */
  1107. X!         }
  1108. X!         else
  1109. X!         {
  1110. X!             DBUG_PRINT("info", ("no value to reset %s/%s",
  1111. X!                 oracle_sid, two_task));
  1112. X!             DBUG_RETURN(1);
  1113. X          }
  1114. X      }
  1115. X      else
  1116. X      {
  1117. X***************
  1118. X*** 96,102 ****
  1119. X              free(oldsid);
  1120. X          }
  1121. X  
  1122. X!         if ((h = getenv(oracle_sid)) == NULL)
  1123. X          {
  1124. X              /* no previous value to save */
  1125. X              oldsid = NULL;
  1126. X--- 109,117 ----
  1127. X              free(oldsid);
  1128. X          }
  1129. X  
  1130. X!         var = (strchr(db, ':') == NULL) ? oracle_sid : two_task;
  1131. X! 
  1132. X!         if ((h = getenv(var)) == NULL)
  1133. X          {
  1134. X              /* no previous value to save */
  1135. X              oldsid = NULL;
  1136. X***************
  1137. X*** 107,113 ****
  1138. X              {
  1139. X                  DBUG_PRINT("malloc",
  1140. X                      ("insufficient memory for oldsid"));
  1141. X!                 ora_errno = ORAP_NOMEM;
  1142. X              }
  1143. X              else
  1144. X              {
  1145. X--- 122,129 ----
  1146. X              {
  1147. X                  DBUG_PRINT("malloc",
  1148. X                      ("insufficient memory for oldsid"));
  1149. X!                 ora_err.no = ORAP_NOMEM;
  1150. X!                 DBUG_RETURN(0);
  1151. X              }
  1152. X              else
  1153. X              {
  1154. X***************
  1155. X*** 118,128 ****
  1156. X              }
  1157. X          }
  1158. X  
  1159. X!         DBUG_PRINT("info", ("setting oracle_sid to %s", db));
  1160. X!         my_setenv(oracle_sid, db);
  1161. X      }
  1162. X  
  1163. X!     DBUG_VOID_RETURN;
  1164. X  }
  1165. X  
  1166. X  
  1167. X--- 134,150 ----
  1168. X              }
  1169. X          }
  1170. X  
  1171. X!         DBUG_PRINT("info", ("setting %s to %s", var, db));
  1172. X!         my_setenv(var, db);
  1173. X! 
  1174. X!         if (((h = getenv(var)) == NULL) || (strcmp(h, db) != 0))
  1175. X!         {
  1176. X!             DBUG_PRINT("info", ("%s misset to %s", var, h));
  1177. X!             DBUG_RETURN(0);
  1178. X!         }
  1179. X      }
  1180. X  
  1181. X!     DBUG_RETURN(1);
  1182. X  }
  1183. X  
  1184. X  
  1185. X***************
  1186. X*** 150,164 ****
  1187. X  
  1188. X      if (*database != '\0')
  1189. X      {
  1190. X!         set_sid(database);
  1191. X!         if (((tmp = getenv(oracle_sid)) == NULL)    ||
  1192. X!              (strcmp(database, tmp) != 0))
  1193. X          {
  1194. X              (void) ora_dropcursor(lda);
  1195. X!             ora_errno = ORAP_NOSID;
  1196. X!             DBUG_PRINT("exit",
  1197. X!                 ("%s misset to %s, returning NULL",
  1198. X!                 oracle_sid, tmp ? tmp : "<NULL>"));
  1199. X              DBUG_RETURN(NULL);
  1200. X          }
  1201. X      }
  1202. X--- 172,182 ----
  1203. X  
  1204. X      if (*database != '\0')
  1205. X      {
  1206. X!         if (set_sid(database) == 0)
  1207. X          {
  1208. X              (void) ora_dropcursor(lda);
  1209. X!             ora_err.no = ORAP_NOSID;
  1210. X!             DBUG_PRINT("exit", ("couldn't set database ID"));
  1211. X              DBUG_RETURN(NULL);
  1212. X          }
  1213. X      }
  1214. X***************
  1215. X*** 178,192 ****
  1216. X          sprintf(address, "%#lx", (long) lda);
  1217. X          DBUG_PRINT("conv", ("lda %#lx converted to string \"%s\"",
  1218. X              (long) lda, address));
  1219. X!         ora_errno = 0;
  1220. X          DBUG_PRINT("exit", ("returning lda %s", address));
  1221. X          DBUG_RETURN(address);
  1222. X      }
  1223. X      else
  1224. X      {
  1225. X!         ora_errno = lda->csr->csrrc;
  1226. X          (void) ora_droplda(lda);
  1227. X!         DBUG_PRINT("exit", ("orlon failed (error %d)", ora_errno));
  1228. X          DBUG_RETURN((char *) NULL);
  1229. X      }
  1230. X  }
  1231. X--- 196,215 ----
  1232. X          sprintf(address, "%#lx", (long) lda);
  1233. X          DBUG_PRINT("conv", ("lda %#lx converted to string \"%s\"",
  1234. X              (long) lda, address));
  1235. X!         ora_err.no = 0;
  1236. X!         ora_err.lda = NULL;
  1237. X          DBUG_PRINT("exit", ("returning lda %s", address));
  1238. X          DBUG_RETURN(address);
  1239. X      }
  1240. X      else
  1241. X      {
  1242. X!         ora_err.no = lda->csr->csrrc;
  1243. X!         ora_err.lda = NULL;    /* this ought to be lda, not NULL
  1244. X!                      * but as we're about to drop the
  1245. X!                      * lda, that wouldn't make sense
  1246. X!                      */
  1247. X          (void) ora_droplda(lda);
  1248. X!         DBUG_PRINT("exit", ("orlon failed (error %d)", ora_err.no));
  1249. X          DBUG_RETURN((char *) NULL);
  1250. X      }
  1251. X  }
  1252. X***************
  1253. X*** 213,219 ****
  1254. X  
  1255. X      if (check_lda(lda) == 0)
  1256. X      {
  1257. X!         ora_errno = ORAP_INVLDA;
  1258. X          DBUG_PRINT("exit", ("invalid lda, returning NULL"));
  1259. X          DBUG_RETURN((char *) NULL);
  1260. X      }
  1261. X--- 236,242 ----
  1262. X  
  1263. X      if (check_lda(lda) == 0)
  1264. X      {
  1265. X!         ora_err.no = ORAP_INVLDA;
  1266. X          DBUG_PRINT("exit", ("invalid lda, returning NULL"));
  1267. X          DBUG_RETURN((char *) NULL);
  1268. X      }
  1269. X***************
  1270. X*** 223,228 ****
  1271. X--- 246,252 ----
  1272. X          DBUG_PRINT("exit", ("can't get a cursor, returning NULL"));
  1273. X          DBUG_RETURN((char *) NULL);
  1274. X      }
  1275. X+     csr->parent = lda;
  1276. X  
  1277. X      /* Check whether there are any substitution variables in the statement
  1278. X       * If there are, we don't execute the statement yet.
  1279. X***************
  1280. X*** 229,235 ****
  1281. X       */
  1282. X      if ((csr->varfields = count_colons(stmt)) < 0)
  1283. X      {
  1284. X!         ora_errno = ORAP_BADVAR;
  1285. X          DBUG_PRINT("exit", ("invalid variable sequence"));
  1286. X          DBUG_RETURN((char *) NULL);
  1287. X      }
  1288. X--- 253,259 ----
  1289. X       */
  1290. X      if ((csr->varfields = count_colons(stmt)) < 0)
  1291. X      {
  1292. X!         ora_err.no = ORAP_BADVAR;
  1293. X          DBUG_PRINT("exit", ("invalid variable sequence"));
  1294. X          DBUG_RETURN((char *) NULL);
  1295. X      }
  1296. X***************
  1297. X*** 242,252 ****
  1298. X          || (osql3(csr->csr, stmt, -1) != 0)
  1299. X          || ((csr->varfields == 0) && (oexec(csr->csr) != 0)))
  1300. X      {
  1301. X!         ora_errno = csr->csr->csrrc;
  1302. X          oclose(csr->csr);
  1303. X          (void) ora_dropcursor(csr);
  1304. X          DBUG_PRINT("exit",
  1305. X!             ("couldn't run SQL statement (error %d)", ora_errno));
  1306. X          DBUG_RETURN((char *) NULL);
  1307. X      }
  1308. X  
  1309. X--- 266,277 ----
  1310. X          || (osql3(csr->csr, stmt, -1) != 0)
  1311. X          || ((csr->varfields == 0) && (oexec(csr->csr) != 0)))
  1312. X      {
  1313. X!         ora_err.no = csr->csr->csrrc;
  1314. X!         ora_err.lda = lda;
  1315. X          oclose(csr->csr);
  1316. X          (void) ora_dropcursor(csr);
  1317. X          DBUG_PRINT("exit",
  1318. X!             ("couldn't run SQL statement (error %d)", ora_err.no));
  1319. X          DBUG_RETURN((char *) NULL);
  1320. X      }
  1321. X  
  1322. X***************
  1323. X*** 259,265 ****
  1324. X              (short *) 0, (char *) 0, (short *) 0, (short *) 0);
  1325. X      } while (csr->csr->csrrc == 0);
  1326. X      --i;
  1327. X!     ora_errno = 0;
  1328. X  
  1329. X      /* set up csr->data  to receive the information when we do a fetch
  1330. X       *      csr->rcode to receive the column return codes
  1331. X--- 284,291 ----
  1332. X              (short *) 0, (char *) 0, (short *) 0, (short *) 0);
  1333. X      } while (csr->csr->csrrc == 0);
  1334. X      --i;
  1335. X!     ora_err.no = 0;
  1336. X!     ora_err.lda = NULL;
  1337. X  
  1338. X      /* set up csr->data  to receive the information when we do a fetch
  1339. X       *      csr->rcode to receive the column return codes
  1340. X***************
  1341. X*** 282,288 ****
  1342. X              DBUG_PRINT("malloc", ("insufficient memory for data"));
  1343. X              oclose(csr->csr);
  1344. X              (void) ora_dropcursor(csr);
  1345. X!             ora_errno = ORAP_NOMEM;
  1346. X              DBUG_PRINT("exit", ("returning NULL"));
  1347. X              DBUG_RETURN((char *) NULL);
  1348. X          }
  1349. X--- 308,314 ----
  1350. X              DBUG_PRINT("malloc", ("insufficient memory for data"));
  1351. X              oclose(csr->csr);
  1352. X              (void) ora_dropcursor(csr);
  1353. X!             ora_err.no = ORAP_NOMEM;
  1354. X              DBUG_PRINT("exit", ("returning NULL"));
  1355. X              DBUG_RETURN((char *) NULL);
  1356. X          }
  1357. X***************
  1358. X*** 296,302 ****
  1359. X              DBUG_PRINT("malloc", ("insufficient memory for len"));
  1360. X              oclose(csr->csr);
  1361. X              (void) ora_dropcursor(csr);
  1362. X!             ora_errno = ORAP_NOMEM;
  1363. X              DBUG_PRINT("exit", ("returning NULL"));
  1364. X              DBUG_RETURN((char *) NULL);
  1365. X          }
  1366. X--- 322,328 ----
  1367. X              DBUG_PRINT("malloc", ("insufficient memory for len"));
  1368. X              oclose(csr->csr);
  1369. X              (void) ora_dropcursor(csr);
  1370. X!             ora_err.no = ORAP_NOMEM;
  1371. X              DBUG_PRINT("exit", ("returning NULL"));
  1372. X              DBUG_RETURN((char *) NULL);
  1373. X          }
  1374. X***************
  1375. X*** 308,314 ****
  1376. X              DBUG_PRINT("malloc", ("insufficient memory for rcode"));
  1377. X              oclose(csr->csr);
  1378. X              (void) ora_dropcursor(csr);
  1379. X!             ora_errno = ORAP_NOMEM;
  1380. X              DBUG_PRINT("exit", ("returning NULL"));
  1381. X              DBUG_RETURN((char *) NULL);
  1382. X          }
  1383. X--- 334,340 ----
  1384. X              DBUG_PRINT("malloc", ("insufficient memory for rcode"));
  1385. X              oclose(csr->csr);
  1386. X              (void) ora_dropcursor(csr);
  1387. X!             ora_err.no = ORAP_NOMEM;
  1388. X              DBUG_PRINT("exit", ("returning NULL"));
  1389. X              DBUG_RETURN((char *) NULL);
  1390. X          }
  1391. X***************
  1392. X*** 321,327 ****
  1393. X              DBUG_PRINT("malloc", ("insufficient memory for type"));
  1394. X              oclose(csr->csr);
  1395. X              (void) ora_dropcursor(csr);
  1396. X!             ora_errno = ORAP_NOMEM;
  1397. X              DBUG_PRINT("exit", ("returning NULL"));
  1398. X              DBUG_RETURN((char *) NULL);
  1399. X          }
  1400. X--- 347,353 ----
  1401. X              DBUG_PRINT("malloc", ("insufficient memory for type"));
  1402. X              oclose(csr->csr);
  1403. X              (void) ora_dropcursor(csr);
  1404. X!             ora_err.no = ORAP_NOMEM;
  1405. X              DBUG_PRINT("exit", ("returning NULL"));
  1406. X              DBUG_RETURN((char *) NULL);
  1407. X          }
  1408. X***************
  1409. X*** 352,358 ****
  1410. X                      ("insufficient memory for data[%d]", i));
  1411. X                  oclose(csr->csr);
  1412. X                  (void) ora_dropcursor(csr);
  1413. X!                 ora_errno = ORAP_NOMEM;
  1414. X                  DBUG_PRINT("exit", ("returning NULL"));
  1415. X                  DBUG_RETURN((char *) NULL);
  1416. X              }
  1417. X--- 378,384 ----
  1418. X                      ("insufficient memory for data[%d]", i));
  1419. X                  oclose(csr->csr);
  1420. X                  (void) ora_dropcursor(csr);
  1421. X!                 ora_err.no = ORAP_NOMEM;
  1422. X                  DBUG_PRINT("exit", ("returning NULL"));
  1423. X                  DBUG_RETURN((char *) NULL);
  1424. X              }
  1425. X***************
  1426. X*** 366,372 ****
  1427. X                      ("insufficient memory for rcode[%d]", i));
  1428. X                  oclose(csr->csr);
  1429. X                  (void) ora_dropcursor(csr);
  1430. X!                 ora_errno = ORAP_NOMEM;
  1431. X                  DBUG_PRINT("exit", ("returning NULL"));
  1432. X                  DBUG_RETURN((char *) NULL);
  1433. X              }
  1434. X--- 392,398 ----
  1435. X                      ("insufficient memory for rcode[%d]", i));
  1436. X                  oclose(csr->csr);
  1437. X                  (void) ora_dropcursor(csr);
  1438. X!                 ora_err.no = ORAP_NOMEM;
  1439. X                  DBUG_PRINT("exit", ("returning NULL"));
  1440. X                  DBUG_RETURN((char *) NULL);
  1441. X              }
  1442. X***************
  1443. X*** 400,406 ****
  1444. X                      ("insufficient memory for ora_result"));
  1445. X                  oclose(csr->csr);
  1446. X                  (void) ora_dropcursor(csr);
  1447. X!                 ora_errno = ORAP_NOMEM;
  1448. X                  DBUG_PRINT("exit", ("returning NULL"));
  1449. X                  DBUG_RETURN((char *) NULL);
  1450. X              }
  1451. X--- 426,432 ----
  1452. X                      ("insufficient memory for ora_result"));
  1453. X                  oclose(csr->csr);
  1454. X                  (void) ora_dropcursor(csr);
  1455. X!                 ora_err.no = ORAP_NOMEM;
  1456. X                  DBUG_PRINT("exit", ("returning NULL"));
  1457. X                  DBUG_RETURN((char *) NULL);
  1458. X              }
  1459. X***************
  1460. X*** 454,472 ****
  1461. X  
  1462. X      if (check_csr(csr) == 0)
  1463. X      {
  1464. X!         ora_errno = ORAP_INVCSR;
  1465. X          DBUG_PRINT("exit", ("not a csr"));
  1466. X          DBUG_RETURN(0);
  1467. X      }
  1468. X      else if (csr->nfields == 0)
  1469. X      {
  1470. X!         ora_errno = ORAP_NODATA;
  1471. X          DBUG_PRINT("exit", ("nothing to return"));
  1472. X          DBUG_RETURN(0);
  1473. X      }
  1474. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1475. X      {
  1476. X!         ora_errno = ORAP_NOMEM;
  1477. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1478. X          DBUG_RETURN(0);
  1479. X      }
  1480. X--- 480,498 ----
  1481. X  
  1482. X      if (check_csr(csr) == 0)
  1483. X      {
  1484. X!         ora_err.no = ORAP_INVCSR;
  1485. X          DBUG_PRINT("exit", ("not a csr"));
  1486. X          DBUG_RETURN(0);
  1487. X      }
  1488. X      else if (csr->nfields == 0)
  1489. X      {
  1490. X!         ora_err.no = ORAP_NODATA;
  1491. X          DBUG_PRINT("exit", ("nothing to return"));
  1492. X          DBUG_RETURN(0);
  1493. X      }
  1494. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1495. X      {
  1496. X!         ora_err.no = ORAP_NOMEM;
  1497. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1498. X          DBUG_RETURN(0);
  1499. X      }
  1500. X***************
  1501. X*** 515,521 ****
  1502. X              i, (long) ora_result[i], ora_result[i]));
  1503. X      }
  1504. X  
  1505. X!     ora_errno = 0;
  1506. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1507. X      DBUG_RETURN(csr->nfields);
  1508. X  }
  1509. X--- 541,548 ----
  1510. X              i, (long) ora_result[i], ora_result[i]));
  1511. X      }
  1512. X  
  1513. X!     ora_err.no = 0;
  1514. X!     ora_err.lda = NULL;
  1515. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1516. X      DBUG_RETURN(csr->nfields);
  1517. X  }
  1518. X***************
  1519. X*** 541,559 ****
  1520. X  
  1521. X      if (check_csr(csr) == 0)
  1522. X      {
  1523. X!         ora_errno = ORAP_INVCSR;
  1524. X          DBUG_PRINT("exit", ("not a csr"));
  1525. X          DBUG_RETURN(0);
  1526. X      }
  1527. X      else if (csr->nfields == 0)
  1528. X      {
  1529. X!         ora_errno = ORAP_NODATA;
  1530. X          DBUG_PRINT("exit", ("nothing to return"));
  1531. X          DBUG_RETURN(0);
  1532. X      }
  1533. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1534. X      {
  1535. X!         ora_errno = ORAP_NOMEM;
  1536. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1537. X          DBUG_RETURN(0);
  1538. X      }
  1539. X--- 568,586 ----
  1540. X  
  1541. X      if (check_csr(csr) == 0)
  1542. X      {
  1543. X!         ora_err.no = ORAP_INVCSR;
  1544. X          DBUG_PRINT("exit", ("not a csr"));
  1545. X          DBUG_RETURN(0);
  1546. X      }
  1547. X      else if (csr->nfields == 0)
  1548. X      {
  1549. X!         ora_err.no = ORAP_NODATA;
  1550. X          DBUG_PRINT("exit", ("nothing to return"));
  1551. X          DBUG_RETURN(0);
  1552. X      }
  1553. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1554. X      {
  1555. X!         ora_err.no = ORAP_NOMEM;
  1556. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1557. X          DBUG_RETURN(0);
  1558. X      }
  1559. X***************
  1560. X*** 567,573 ****
  1561. X              i, (long) csr->data[i], csr->data[i]));
  1562. X      }
  1563. X  
  1564. X!     ora_errno = 0;
  1565. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1566. X      DBUG_RETURN(csr->nfields);
  1567. X  }
  1568. X--- 594,601 ----
  1569. X              i, (long) csr->data[i], csr->data[i]));
  1570. X      }
  1571. X  
  1572. X!     ora_err.no = 0;
  1573. X!     ora_err.lda = csr->parent;
  1574. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1575. X      DBUG_RETURN(csr->nfields);
  1576. X  }
  1577. X***************
  1578. X*** 594,612 ****
  1579. X  
  1580. X      if (check_csr(csr) == 0)
  1581. X      {
  1582. X!         ora_errno = ORAP_INVCSR;
  1583. X          DBUG_PRINT("exit", ("not a csr"));
  1584. X          DBUG_RETURN(0);
  1585. X      }
  1586. X      else if (csr->nfields == 0)
  1587. X      {
  1588. X!         ora_errno = ORAP_NODATA;
  1589. X          DBUG_PRINT("exit", ("nothing to return"));
  1590. X          DBUG_RETURN(0);
  1591. X      }
  1592. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1593. X      {
  1594. X!         ora_errno = ORAP_NOMEM;
  1595. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1596. X          DBUG_RETURN(0);
  1597. X      }
  1598. X--- 622,640 ----
  1599. X  
  1600. X      if (check_csr(csr) == 0)
  1601. X      {
  1602. X!         ora_err.no = ORAP_INVCSR;
  1603. X          DBUG_PRINT("exit", ("not a csr"));
  1604. X          DBUG_RETURN(0);
  1605. X      }
  1606. X      else if (csr->nfields == 0)
  1607. X      {
  1608. X!         ora_err.no = ORAP_NODATA;
  1609. X          DBUG_PRINT("exit", ("nothing to return"));
  1610. X          DBUG_RETURN(0);
  1611. X      }
  1612. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1613. X      {
  1614. X!         ora_err.no = ORAP_NOMEM;
  1615. X          DBUG_PRINT("exit", ("ora_result is not assigned correctly"));
  1616. X          DBUG_RETURN(0);
  1617. X      }
  1618. X***************
  1619. X*** 621,627 ****
  1620. X              types[csr->type[i]] ? types[csr->type[i]] : "unknown"));
  1621. X      }
  1622. X  
  1623. X!     ora_errno = 0;
  1624. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1625. X      DBUG_RETURN(csr->nfields);
  1626. X  }
  1627. X--- 649,656 ----
  1628. X              types[csr->type[i]] ? types[csr->type[i]] : "unknown"));
  1629. X      }
  1630. X  
  1631. X!     ora_err.no = 0;
  1632. X!     ora_err.lda = NULL;
  1633. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1634. X      DBUG_RETURN(csr->nfields);
  1635. X  }
  1636. X***************
  1637. X*** 648,666 ****
  1638. X  
  1639. X      if (check_csr(csr) == 0)
  1640. X      {
  1641. X!         ora_errno = ORAP_INVCSR;
  1642. X          DBUG_PRINT("exit", ("not a csr"));
  1643. X          DBUG_RETURN(0);
  1644. X      }
  1645. X      else if (csr->nfields == 0)
  1646. X      {
  1647. X!         ora_errno = ORAP_NODATA;
  1648. X          DBUG_PRINT("exit", ("no data to return"));
  1649. X          DBUG_RETURN(0);
  1650. X      }
  1651. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1652. X      {
  1653. X!         ora_errno = ORAP_NOMEM;
  1654. X          DBUG_PRINT("exit", ("ora_result is not assigned"));
  1655. X          DBUG_RETURN(0);
  1656. X      }
  1657. X--- 677,695 ----
  1658. X  
  1659. X      if (check_csr(csr) == 0)
  1660. X      {
  1661. X!         ora_err.no = ORAP_INVCSR;
  1662. X          DBUG_PRINT("exit", ("not a csr"));
  1663. X          DBUG_RETURN(0);
  1664. X      }
  1665. X      else if (csr->nfields == 0)
  1666. X      {
  1667. X!         ora_err.no = ORAP_NODATA;
  1668. X          DBUG_PRINT("exit", ("no data to return"));
  1669. X          DBUG_RETURN(0);
  1670. X      }
  1671. X      else if ((ora_result == NULL) || (ora_nfields < csr->nfields))
  1672. X      {
  1673. X!         ora_err.no = ORAP_NOMEM;
  1674. X          DBUG_PRINT("exit", ("ora_result is not assigned"));
  1675. X          DBUG_RETURN(0);
  1676. X      }
  1677. X***************
  1678. X*** 671,677 ****
  1679. X  
  1680. X          if (csr->end_of_data)
  1681. X          {
  1682. X!             ora_errno = 0;
  1683. X              DBUG_PRINT("exit", ("end of data"));
  1684. X              DBUG_RETURN(0);
  1685. X          }
  1686. X--- 700,707 ----
  1687. X  
  1688. X          if (csr->end_of_data)
  1689. X          {
  1690. X!             ora_err.no = 0;
  1691. X!             ora_err.lda = csr->parent;
  1692. X              DBUG_PRINT("exit", ("end of data"));
  1693. X              DBUG_RETURN(0);
  1694. X          }
  1695. X***************
  1696. X*** 691,705 ****
  1697. X          {
  1698. X              if ((i == 1) && (csr->csr->csrrc == 4))
  1699. X              {
  1700. X!                 ora_errno = 0;
  1701. X                  DBUG_PRINT("exit", ("end of data"));
  1702. X                  DBUG_RETURN(0);
  1703. X              }
  1704. X              else
  1705. X              {
  1706. X!                 ora_errno = csr->csr->csrrc;
  1707. X                  DBUG_PRINT("exit",
  1708. X!                     ("ofen error (%d)", ora_errno));
  1709. X                  DBUG_RETURN(0);
  1710. X              }
  1711. X          }
  1712. X--- 721,737 ----
  1713. X          {
  1714. X              if ((i == 1) && (csr->csr->csrrc == 4))
  1715. X              {
  1716. X!                 ora_err.no = 0;
  1717. X!                 ora_err.lda = csr->parent;
  1718. X                  DBUG_PRINT("exit", ("end of data"));
  1719. X                  DBUG_RETURN(0);
  1720. X              }
  1721. X              else
  1722. X              {
  1723. X!                 ora_err.no = csr->csr->csrrc;
  1724. X!                 ora_err.lda = csr->parent;
  1725. X                  DBUG_PRINT("exit",
  1726. X!                     ("ofen error (%d)", ora_err.no));
  1727. X                  DBUG_RETURN(0);
  1728. X              }
  1729. X          }
  1730. X***************
  1731. X*** 722,728 ****
  1732. X              break;
  1733. X  
  1734. X          case 1406:
  1735. X!             ora_errno = 1406;
  1736. X  
  1737. X              if (trunc    &&
  1738. X                  ((csr->type[i] == 8) || (csr->type[i] == 24)))
  1739. X--- 754,761 ----
  1740. X              break;
  1741. X  
  1742. X          case 1406:
  1743. X!             ora_err.no = 1406;
  1744. X!             ora_err.lda = csr->parent;
  1745. X  
  1746. X              if (trunc    &&
  1747. X                  ((csr->type[i] == 8) || (csr->type[i] == 24)))
  1748. X***************
  1749. X*** 744,750 ****
  1750. X          default:    /* others should not happen */
  1751. X              DBUG_PRINT("info", ("ofetch error %d, field %d",
  1752. X                  csr->rcode[i][csr->next_entry], i));
  1753. X!             ora_errno = csr->csr->csrrc;
  1754. X              DBUG_PRINT("exit", ("returning 0"));
  1755. X              DBUG_RETURN(0);
  1756. X          }
  1757. X--- 777,784 ----
  1758. X          default:    /* others should not happen */
  1759. X              DBUG_PRINT("info", ("ofetch error %d, field %d",
  1760. X                  csr->rcode[i][csr->next_entry], i));
  1761. X!             ora_err.no = csr->csr->csrrc;
  1762. X!             ora_err.lda = csr->parent;
  1763. X              DBUG_PRINT("exit", ("returning 0"));
  1764. X              DBUG_RETURN(0);
  1765. X          }
  1766. X***************
  1767. X*** 757,763 ****
  1768. X      ++csr->next_entry;
  1769. X      --csr->in_cache;
  1770. X  
  1771. X!     ora_errno = 0;
  1772. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1773. X      DBUG_RETURN(csr->nfields);
  1774. X  }
  1775. X--- 791,798 ----
  1776. X      ++csr->next_entry;
  1777. X      --csr->in_cache;
  1778. X  
  1779. X!     ora_err.no = 0;
  1780. X!     ora_err.lda = csr->parent;
  1781. X      DBUG_PRINT("exit", ("returning %d items", csr->nfields));
  1782. X      DBUG_RETURN(csr->nfields);
  1783. X  }
  1784. X***************
  1785. X*** 786,798 ****
  1786. X  
  1787. X      if (check_csr(csr) == 0)
  1788. X      {
  1789. X!         ora_errno = ORAP_INVCSR;
  1790. X          DBUG_PRINT("exit", ("not a csr"));
  1791. X          DBUG_RETURN(-1L);
  1792. X      }
  1793. X      else if (csr->varfields != nitems)
  1794. X      {
  1795. X!         ora_errno = ORAP_NUMVARS;
  1796. X          DBUG_PRINT("exit", ("expected %d items, got %d",
  1797. X              csr->varfields, nitems));
  1798. X          DBUG_RETURN(-1L);
  1799. X--- 821,833 ----
  1800. X  
  1801. X      if (check_csr(csr) == 0)
  1802. X      {
  1803. X!         ora_err.no = ORAP_INVCSR;
  1804. X          DBUG_PRINT("exit", ("not a csr"));
  1805. X          DBUG_RETURN(-1L);
  1806. X      }
  1807. X      else if (csr->varfields != nitems)
  1808. X      {
  1809. X!         ora_err.no = ORAP_NUMVARS;
  1810. X          DBUG_PRINT("exit", ("expected %d items, got %d",
  1811. X              csr->varfields, nitems));
  1812. X          DBUG_RETURN(-1L);
  1813. X***************
  1814. X*** 805,811 ****
  1815. X          if ((obndrn(csr->csr, i+1, (char *) -1, 0,
  1816. X              5, -1, &null_flag, (char *) -1, 0, 0)) != 0)
  1817. X          {
  1818. X!             ora_errno = csr->csr->csrrc;
  1819. X              DBUG_PRINT("exit", ("obndrn failed on field %d, <NULL>",
  1820. X                  i + 1));
  1821. X              DBUG_RETURN(-1L);
  1822. X--- 840,847 ----
  1823. X          if ((obndrn(csr->csr, i+1, (char *) -1, 0,
  1824. X              5, -1, &null_flag, (char *) -1, 0, 0)) != 0)
  1825. X          {
  1826. X!             ora_err.no = csr->csr->csrrc;
  1827. X!             ora_err.lda = csr->parent;
  1828. X              DBUG_PRINT("exit", ("obndrn failed on field %d, <NULL>",
  1829. X                  i + 1));
  1830. X              DBUG_RETURN(-1L);
  1831. X***************
  1832. X*** 825,831 ****
  1833. X          if ((obndrn(csr->csr, i+1, vars[i], strlen(vars[i])+1,
  1834. X              5, -1, (short *) -1, (char *) -1, 0, 0)) != 0)
  1835. X          {
  1836. X!             ora_errno = csr->csr->csrrc;
  1837. X              DBUG_PRINT("exit", ("obndrn failed on field %d, \"%s\"",
  1838. X                  i + 1, vars[i]));
  1839. X              DBUG_RETURN(-1L);
  1840. X--- 861,868 ----
  1841. X          if ((obndrn(csr->csr, i+1, vars[i], strlen(vars[i])+1,
  1842. X              5, -1, (short *) -1, (char *) -1, 0, 0)) != 0)
  1843. X          {
  1844. X!             ora_err.no = csr->csr->csrrc;
  1845. X!             ora_err.lda = csr->parent;
  1846. X              DBUG_PRINT("exit", ("obndrn failed on field %d, \"%s\"",
  1847. X                  i + 1, vars[i]));
  1848. X              DBUG_RETURN(-1L);
  1849. X***************
  1850. X*** 837,843 ****
  1851. X  
  1852. X      if (oexec(csr->csr) != 0)
  1853. X      {
  1854. X!         ora_errno = csr->csr->csrrc;
  1855. X          DBUG_PRINT("exit", ("oexec failed"));
  1856. X          DBUG_RETURN(-1L);
  1857. X      }
  1858. X--- 874,881 ----
  1859. X  
  1860. X      if (oexec(csr->csr) != 0)
  1861. X      {
  1862. X!         ora_err.no = csr->csr->csrrc;
  1863. X!         ora_err.lda = csr->parent;
  1864. X          DBUG_PRINT("exit", ("oexec failed"));
  1865. X          DBUG_RETURN(-1L);
  1866. X      }
  1867. X***************
  1868. X*** 918,930 ****
  1869. X  
  1870. X      if (check_csr(csr) == 0)
  1871. X      {
  1872. X!         ora_errno = ORAP_INVCSR;
  1873. X          DBUG_PRINT("exit", ("not a csr"));
  1874. X          DBUG_RETURN(NULL);
  1875. X      }
  1876. X      else if (oclose(csr->csr) != 0)
  1877. X      {
  1878. X!         ora_errno = csr->csr->csrrc;
  1879. X          DBUG_PRINT("exit", ("oclose failed"));
  1880. X          DBUG_RETURN(NULL);
  1881. X      }
  1882. X--- 956,969 ----
  1883. X  
  1884. X      if (check_csr(csr) == 0)
  1885. X      {
  1886. X!         ora_err.no = ORAP_INVCSR;
  1887. X          DBUG_PRINT("exit", ("not a csr"));
  1888. X          DBUG_RETURN(NULL);
  1889. X      }
  1890. X      else if (oclose(csr->csr) != 0)
  1891. X      {
  1892. X!         ora_err.no = csr->csr->csrrc;
  1893. X!         ora_err.lda = csr->parent;
  1894. X          DBUG_PRINT("exit", ("oclose failed"));
  1895. X          DBUG_RETURN(NULL);
  1896. X      }
  1897. X***************
  1898. X*** 953,966 ****
  1899. X  
  1900. X      if (check_lda(lda) == 0)
  1901. X      {
  1902. X!         ora_errno = ORAP_INVLDA;
  1903. X          DBUG_PRINT("exit", ("not an lda"));
  1904. X          DBUG_RETURN(NULL);
  1905. X      }
  1906. X      else if (ologof(lda->csr) != 0)
  1907. X      {
  1908. X!         ora_errno = lda->csr->csrrc;
  1909. X!         DBUG_PRINT("exit", ("ologof failed, error code %d", ora_errno));
  1910. X          DBUG_RETURN(NULL);
  1911. X      }
  1912. X      else
  1913. X--- 992,1006 ----
  1914. X  
  1915. X      if (check_lda(lda) == 0)
  1916. X      {
  1917. X!         ora_err.no = ORAP_INVLDA;
  1918. X          DBUG_PRINT("exit", ("not an lda"));
  1919. X          DBUG_RETURN(NULL);
  1920. X      }
  1921. X      else if (ologof(lda->csr) != 0)
  1922. X      {
  1923. X!         ora_err.no = lda->csr->csrrc;
  1924. X!         ora_err.lda = lda;
  1925. X!         DBUG_PRINT("exit", ("ologof failed, error code %d",ora_err.no));
  1926. X          DBUG_RETURN(NULL);
  1927. X      }
  1928. X      else
  1929. X***************
  1930. X*** 988,1001 ****
  1931. X  
  1932. X      if (check_lda(lda) == 0)
  1933. X      {
  1934. X!         ora_errno = ORAP_INVLDA;
  1935. X          DBUG_PRINT("exit", ("not an lda"));
  1936. X          DBUG_RETURN(NULL);
  1937. X      }
  1938. X      else if (ocom(lda->csr) != 0)
  1939. X      {
  1940. X!         ora_errno = lda->csr->csrrc;
  1941. X!         DBUG_PRINT("exit", ("ocom failed, error code %d", ora_errno));
  1942. X          DBUG_RETURN(NULL);
  1943. X      }
  1944. X      else
  1945. X--- 1028,1042 ----
  1946. X  
  1947. X      if (check_lda(lda) == 0)
  1948. X      {
  1949. X!         ora_err.no = ORAP_INVLDA;
  1950. X          DBUG_PRINT("exit", ("not an lda"));
  1951. X          DBUG_RETURN(NULL);
  1952. X      }
  1953. X      else if (ocom(lda->csr) != 0)
  1954. X      {
  1955. X!         ora_err.no = lda->csr->csrrc;
  1956. X!         ora_err.lda = lda;
  1957. X!         DBUG_PRINT("exit", ("ocom failed, error code %d", ora_err.no));
  1958. X          DBUG_RETURN(NULL);
  1959. X      }
  1960. X      else
  1961. X***************
  1962. X*** 1022,1035 ****
  1963. X  
  1964. X      if (check_lda(lda) == 0)
  1965. X      {
  1966. X!         ora_errno = ORAP_INVLDA;
  1967. X          DBUG_PRINT("exit", ("not an lda", stderr));
  1968. X          DBUG_RETURN(NULL);
  1969. X      }
  1970. X      else if (orol(lda->csr) != 0)
  1971. X      {
  1972. X!         ora_errno = lda->csr->csrrc;
  1973. X!         DBUG_PRINT("exit", ("orol failed, error code %d", ora_errno));
  1974. X          DBUG_RETURN(NULL);
  1975. X      }
  1976. X      else
  1977. X--- 1063,1077 ----
  1978. X  
  1979. X      if (check_lda(lda) == 0)
  1980. X      {
  1981. X!         ora_err.no = ORAP_INVLDA;
  1982. X          DBUG_PRINT("exit", ("not an lda", stderr));
  1983. X          DBUG_RETURN(NULL);
  1984. X      }
  1985. X      else if (orol(lda->csr) != 0)
  1986. X      {
  1987. X!         ora_err.no = lda->csr->csrrc;
  1988. X!         ora_err.lda = lda;
  1989. X!         DBUG_PRINT("exit", ("orol failed, error code %d", ora_err.no));
  1990. X          DBUG_RETURN(NULL);
  1991. X      }
  1992. X      else
  1993. X***************
  1994. X*** 1057,1063 ****
  1995. X  
  1996. X      if (check_lda(lda) == 0)
  1997. X      {
  1998. X!         ora_errno = ORAP_INVLDA;
  1999. X          DBUG_PRINT("exit", ("not an lda", stderr));
  2000. X          DBUG_RETURN(NULL);
  2001. X      }
  2002. X--- 1099,1105 ----
  2003. X  
  2004. X      if (check_lda(lda) == 0)
  2005. X      {
  2006. X!         ora_err.no = ORAP_INVLDA;
  2007. X          DBUG_PRINT("exit", ("not an lda", stderr));
  2008. X          DBUG_RETURN(NULL);
  2009. X      }
  2010. X***************
  2011. X*** 1066,1074 ****
  2012. X      {
  2013. X          if (ocon(lda->csr) != 0)
  2014. X          {
  2015. X!             ora_errno = lda->csr->csrrc;
  2016. X              DBUG_PRINT("exit",
  2017. X!                 ("ocon failed, error code %d", ora_errno));
  2018. X              DBUG_RETURN(NULL);
  2019. X          }
  2020. X      }
  2021. X--- 1108,1117 ----
  2022. X      {
  2023. X          if (ocon(lda->csr) != 0)
  2024. X          {
  2025. X!             ora_err.no = lda->csr->csrrc;
  2026. X!             ora_err.lda = lda;
  2027. X              DBUG_PRINT("exit",
  2028. X!                 ("ocon failed, error code %d", ora_err.no));
  2029. X              DBUG_RETURN(NULL);
  2030. X          }
  2031. X      }
  2032. X***************
  2033. X*** 1076,1084 ****
  2034. X      {
  2035. X          if (ocof(lda->csr) != 0)
  2036. X          {
  2037. X!             ora_errno = lda->csr->csrrc;
  2038. X              DBUG_PRINT("exit",
  2039. X!                 ("ocof failed, error code %d", ora_errno));
  2040. X              DBUG_RETURN(NULL);
  2041. X          }
  2042. X      }
  2043. X--- 1119,1128 ----
  2044. X      {
  2045. X          if (ocof(lda->csr) != 0)
  2046. X          {
  2047. X!             ora_err.no = lda->csr->csrrc;
  2048. X!             ora_err.lda = lda;
  2049. X              DBUG_PRINT("exit",
  2050. X!                 ("ocof failed, error code %d", ora_err.no));
  2051. X              DBUG_RETURN(NULL);
  2052. X          }
  2053. X      }
  2054. Xdiff -cr oraperl-v2/orafns.h oraperl-v2.4/orafns.h
  2055. X*** oraperl-v2/orafns.h    Wed Jun  9 12:33:45 1993
  2056. X--- oraperl-v2.4/orafns.h    Wed Jun  9 11:28:54 1993
  2057. X***************
  2058. X*** 2,8 ****
  2059. X   *
  2060. X   * Common declarations for the Oraperl functions
  2061. X   */
  2062. X! /* Copyright 1991, 1992 Kevin Stock.
  2063. X   *
  2064. X   * You may copy this under the terms of the GNU General Public License,
  2065. X   * or the Artistic License, copies of which should have accompanied your
  2066. X--- 2,8 ----
  2067. X   *
  2068. X   * Common declarations for the Oraperl functions
  2069. X   */
  2070. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  2071. X   *
  2072. X   * You may copy this under the terms of the GNU General Public License,
  2073. X   * or the Artistic License, copies of which should have accompanied your
  2074. X***************
  2075. X*** 86,92 ****
  2076. X              next_entry,    /* next valid cache entry         */
  2077. X              nfields,    /* number of fields to retrieve         */
  2078. X              varfields;    /* number of modifiable variables    */
  2079. X!     struct    cursor    *next;        /* list pointer                 */
  2080. X  };
  2081. X  
  2082. X  
  2083. X--- 86,93 ----
  2084. X              next_entry,    /* next valid cache entry         */
  2085. X              nfields,    /* number of fields to retrieve         */
  2086. X              varfields;    /* number of modifiable variables    */
  2087. X!     struct    cursor    *next,        /* list pointer                 */
  2088. X!             *parent;    /* lda related to this csr         */
  2089. X  };
  2090. X  
  2091. X  
  2092. X***************
  2093. X*** 105,112 ****
  2094. X  
  2095. X  /* variables accesible to the outside world */
  2096. X  
  2097. X! EXT    int    ora_errno    INIT(0),    /* latest error code         */
  2098. X!         ora_long    INIT(80),    /* length of LONG fields     */
  2099. X          ora_nfields    INIT(0),    /* size of ora_result array  */
  2100. X          ora_trunc    INIT(0);    /* allow LONG truncation?    */
  2101. X  
  2102. X--- 106,122 ----
  2103. X  
  2104. X  /* variables accesible to the outside world */
  2105. X  
  2106. X! EXT    struct                    /* code & lda of last error  */
  2107. X!     {
  2108. X!         int        no;
  2109. X!         struct    cursor    *lda;
  2110. X!     } ora_err
  2111. X! #ifdef    DOINIT
  2112. X!          = { 0, NULL }
  2113. X! #endif
  2114. X!                 ;        /* ends decl of ora_err         */
  2115. X! 
  2116. X! EXT    int    ora_long    INIT(80),    /* length of LONG fields     */
  2117. X          ora_nfields    INIT(0),    /* size of ora_result array  */
  2118. X          ora_trunc    INIT(0);    /* allow LONG truncation?    */
  2119. X  
  2120. Xdiff -cr oraperl-v2/usersub.c oraperl-v2.4/usersub.c
  2121. X*** oraperl-v2/usersub.c    Wed Jun  9 12:32:05 1993
  2122. X--- oraperl-v2.4/usersub.c    Wed Jun  9 11:29:40 1993
  2123. X***************
  2124. X*** 2,8 ****
  2125. X   * 
  2126. X   * Initialisation for Oraperl.
  2127. X   */
  2128. X! /* Copyright 1991, 1992 Kevin Stock.
  2129. X   *
  2130. X   * You may copy this under the terms of the GNU General Public License,
  2131. X   * or the Artistic License, copies of which should have accompanied your
  2132. X--- 2,8 ----
  2133. X   * 
  2134. X   * Initialisation for Oraperl.
  2135. X   */
  2136. X! /* Copyright 1991, 1992, 1993 Kevin Stock.
  2137. X   *
  2138. X   * You may copy this under the terms of the GNU General Public License,
  2139. X   * or the Artistic License, copies of which should have accompanied your
  2140. X***************
  2141. X*** 60,66 ****
  2142. X      warn_on_debug = dowarn;
  2143. X  #endif
  2144. X  
  2145. X!     ora_errno = 0;
  2146. X      DBUG_VOID_RETURN;
  2147. X  }
  2148. X  
  2149. X--- 60,68 ----
  2150. X      warn_on_debug = dowarn;
  2151. X  #endif
  2152. X  
  2153. X!     ora_err.no = 0;
  2154. X!     ora_err.lda = NULL;
  2155. X! 
  2156. X      DBUG_VOID_RETURN;
  2157. X  }
  2158. X  
  2159. X***************
  2160. X*** 117,123 ****
  2161. X  
  2162. X      printf("\nPerl is copyright by Larry Wall; type %s -v for details.\n",
  2163. X          prog);
  2164. X!     printf("Additions for %s: Copyright 1991, 1992, Kevin Stock.\n", prog);
  2165. X  
  2166. X      printf("\n%s may be distributed under the same conditions as Perl.\n\n",
  2167. X          Prog);
  2168. X--- 119,126 ----
  2169. X  
  2170. X      printf("\nPerl is copyright by Larry Wall; type %s -v for details.\n",
  2171. X          prog);
  2172. X!     printf("Additions for %s: Copyright 1991, 1992, 1993, Kevin Stock.\n",
  2173. X!         prog);
  2174. X  
  2175. X      printf("\n%s may be distributed under the same conditions as Perl.\n\n",
  2176. X          Prog);
  2177. END_OF_FILE
  2178.   if test 51655 -ne `wc -c <'patch4'`; then
  2179.     echo shar: \"'patch4'\" unpacked with wrong size!
  2180.   fi
  2181.   # end of 'patch4'
  2182. fi
  2183. echo shar: End of archive 1 \(of 1\).
  2184. cp /dev/null ark1isdone
  2185. MISSING=""
  2186. for I in 1 ; do
  2187.     if test ! -f ark${I}isdone ; then
  2188.     MISSING="${MISSING} ${I}"
  2189.     fi
  2190. done
  2191. if test "${MISSING}" = "" ; then
  2192.     echo You have the archive.
  2193.     rm -f ark[1-9]isdone
  2194. else
  2195.     echo You still must unpack the following archives:
  2196.     echo "        " ${MISSING}
  2197. fi
  2198. exit 0
  2199. exit 0 # Just in case...
  2200.